package com.sirap.spring.boot.demo.controller;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.sirap.basic.thirdparty.ServletHelper;
import com.sirap.basic.tool.D;

@Controller
@RequestMapping(value = "/wx")
public class WeixinController extends BaseController {
	
	@RequestMapping(value = "/callback", method = RequestMethod.GET)
	public void doCallback(HttpServletRequest request, HttpServletResponse ponse) throws Exception {
		String signature = request.getParameter("signature");
		String timestamp = request.getParameter("timestamp");
		String nonce = request.getParameter("nonce");
		String echostr = request.getParameter("echostr");

		D.pla(signature, timestamp, nonce, echostr);
		D.pl(ServletHelper.detail(request));
		
		PrintWriter out = ponse.getWriter();
		out.print(echostr);
	}
}
